{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "5b76d024",
   "metadata": {},
   "outputs": [],
   "source": [
    "from imutils import contours\n",
    "import numpy as np\n",
    "import argparse\n",
    "import imutils\n",
    "import cv2\n",
    "# import myutils"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "89d4e84c",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "usage: ipykernel_launcher.py [-h] -i IMAGE -t TEMPLATE\n",
      "ipykernel_launcher.py: error: the following arguments are required: -i/--image, -t/--template\n"
     ]
    },
    {
     "ename": "SystemExit",
     "evalue": "2",
     "output_type": "error",
     "traceback": [
      "An exception has occurred, use %tb to see the full traceback.\n",
      "\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m 2\n"
     ]
    }
   ],
   "source": [
    "# 设置参数\n",
    "ap = argparse.ArgumentParser()\n",
    "ap.add_argument('-i', '--image', required=True, help='path to input image')\n",
    "ap.add_argument('-t', '--template', required=True, help='path to template OCR-A image')\n",
    "args = vars(ap.parse_args())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "9af541b0",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 指定信用卡类型\n",
    "FIRST_NUMBER = {\n",
    "    \"3\": \"American Express\",\n",
    "    \"4\": \"Visa\",\n",
    "    \"5\": \"MasterCard\",\n",
    "    \"6\": \"Discover Card\"\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "dfe08678",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 绘图展示\n",
    "def cv_show(name, img):\n",
    "    cv2_show(name, img)\n",
    "    cv2.waitKey(0)\n",
    "    cv2.destroyAllWindows()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "53ba9c4a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
